<template>
  <el-card class="box-card-component" >
    <div slot="header" class="box-card-header">
      <img :src="get_upload_url()+'wxmini/static/image/shoufuto_bg.png'">
    </div>
    <div style="position:relative;">
      
      <pan-thumb :image="get_upload_url()+'wxmini/static/image/shoufutong.jpg'" class="panThumb" />
      <mallki class-name="mallki-text" text="收付通记录" @onClick="money_visible=true"/>

      <div class="progress-item" style="padding-top:35px;" >
        <div class="sc_warp_item flex_row1">
          <div >未结算金额:(元)</div>
          <el-tag type="success">{{data.accesspay.unsettled}}</el-tag>
        </div>
        <div class="sc_warp_item flex_row1">
          <div >可结算金额:(元)</div>
          <el-tag type="success">{{data.accesspay.is_settled}}</el-tag>
        </div>
        <div class="sc_warp_item flex_row1">
          <div >已结算金额:(元)</div>
          <el-tag type="success">{{data.accesspay.settled}}</el-tag>
        </div>
        <div style="margin-top:5px;">
          <el-button type="success"  size="mini" @click="onSettled">立即结算</el-button>
          
          <router-link to="/extend/order?type=1">
            <el-button type="danger" style="margin-left:8px;" size="mini" >提现</el-button>
          </router-link>
          <!-- <el-button type="primary" style="margin-left:8px;" size="mini" icon="el-icon-edit-outline" @click="money_visible=true" >记录</el-button> -->
        </div>
      </div>
    </div>

    <el-drawer title="资金记录" :visible.sync="money_visible" direction="rtl" :size="device=='mobile'?'100%':'40%'" >
      <money-log />
    </el-drawer>
    

  </el-card>
</template>

<script>
import { mapGetters } from 'vuex'
import PanThumb from '@/components/PanThumb'
import Mallki from '@/components/TextHoverEffect/Mallki'
import moneyLog from '@/components/orderlist/moneyLog'
export default {
  props:['data'],
  components: { PanThumb, Mallki ,moneyLog},
    
  filters: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      money_visible:false,
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'device',
      'roles'
    ])
  },
  methods:{
    //结算
    onSettled () {
      if(this.data.accesspay.is_settled<100){
        this.$msg_ok("success", '结算金额需大于100元')
        return

      }
      let text="当前可结算金额:"+this.data.accesspay.is_settled+"\n"+"结算手续费:"+this.data.settled_proportion+"%\n"+"实际到账金额:"+(this.data.accesspay.is_settled-(this.data.accesspay.is_settled*this.data.settled_proportion/100).toFixed(2))
      this.$msg_confirm_show(text,"结算",true).then(e=>{
        this.get('/admin/Extend/settled', {}, 'POST').then(e => {
          this.$msg_ok("success", e.msg);
          this.data.accesspay=e
        })
      })
    },
  }
}
</script>

<style lang="scss" >
.box-card-component{
  .el-card__header {
    padding: 0px!important;
  }
}
</style>
<style lang="scss" scoped>
.money-log-width{
  width:40%
}
.box-card-component {
  .box-card-header {
    position: relative;
    height: 100px;
    img {
      width: 100%;
      height: 100%;
      transition: all 0.2s linear;
      &:hover {
        transform: scale(1.1, 1.1);
        filter: contrast(130%);
      }
    }
  }
  .mallki-text {
    position: absolute;
    top: 0px;
    right: 0px;
    font-size: 20px;
    font-weight: bold;
  }
  .panThumb {
    z-index: 100;
    height: 70px!important;
    width: 70px!important;
    position: absolute!important;
    top: -45px;
    left: 0px;
    border: 5px solid #ffffff;
    background-color: #fff;
    margin: auto;
    box-shadow: none!important;
    ::v-deep .pan-info {
      box-shadow: none!important;
    }
  }
  .progress-item {
    margin-bottom: 10px;
    font-size: 14px;
  }
  .flex_row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  @media only screen and (max-width: 1510px){

  }
}
</style>
